package com.dferreira.repository.data_models;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.util.List;

@DatabaseTable(tableName = PackageMetadata.TABLE_NAME)
public class PackageMetadata extends PackageCommon {
    public static final String TABLE_NAME = "PackageMetadata";

    public static final String COLUMN_NAME_PATH = "path";
    public static final String COLUMN_NAME_STATE = "state";


    // to know where read information
    @DatabaseField(columnName = COLUMN_NAME_PATH, unique = false)
    private String path;

    /**
     * current state from the package
     */
    @DatabaseField(columnName = COLUMN_NAME_STATE)
    private PackageMetadataState state;

    /**
     * Information about dependencies from the package
     */
    private List<PackageMetadata> dependencies;


    /**
     * @return the path
     */
    public String getPath() {
        return path;
    }

    /**
     * @param path the path to set
     */
    public void setPath(String path) {
        this.path = path;
    }

    /**
     * @return the path where the files from the package exists
     */

    public String getInstalledPath() {
        return path + "/" + this.getName();
    }

    /**
     * @return
     */
    public PackageMetadataState getState() {
        return state;
    }

    /**
     * @param state
     */
    public void setState(PackageMetadataState state) {
        this.state = state;
    }

    /**
     * @return the dependencies
     */
    public List<PackageMetadata> getDependencies() {
        return dependencies;
    }

    /**
     * @param dependencies the dependencies to set
     */
    public void setDependencies(List<PackageMetadata> dependencies) {
        this.dependencies = dependencies;
    }
}
